import type { RoutesType } from './types'
import VerticalMenuWithSubMenu from '@/challenges/VerticalMenuWithSubMenu/VerticalMenuWithSubMenu.vue'
import AlignContent from '@/challenges/FlexBox/AlignContent.vue'
import ToggleButton from '@/challenges/ToggleButton'
import NotificationAndMenuAndSearch from '@/challenges/NotificationAndMenuAndSearch'
import { ClipPathBasic, DarkAndLightMode, OuterHTMLDemo } from '@/challenges/ClipPath'
import { FirstDemo } from '@/basicskills/IntersectionObserver'
import { NavBar } from '@/challenges/NavBar'
import { TableOfContentBasic } from '@/basicskills/TableOfContent'
import { DebounceDemo } from '@/basicskills/Debounce'
import { SignUpForm } from '@/challenges/Form'
import PriceTable from '@/challenges/PriceTable'
import RoratingImageGallery from '@/challenges/RoratingImageGallery'
import StatisticDashBoard from '@/challenges/Statistic'
import DailyProgress from '@/challenges/DailyProgress'
import SliderRadioButtion from '@/challenges/SliderRadioButtion'
import Profile from '@/challenges/Profile'

const prefix = '/challenges'

const getRoutes = (function (prefixKey: string) {
  let routes: RoutesType = {
    '/VerticalMenuWithSubMenu': VerticalMenuWithSubMenu,
    '/AlignContent': AlignContent,
    '/ClipPathBasic': ClipPathBasic,
    '/DarkAndLightMode': DarkAndLightMode,
    '/OuterHTMLDemo': OuterHTMLDemo,
    '/ToggleButton': ToggleButton,
    '/NotificationAndMenuAndSearch': NotificationAndMenuAndSearch,
    '/FirstDemo': FirstDemo,
    '/NavBar': NavBar,
    '/TableOfContentBasic': TableOfContentBasic,
    '/DebounceDemo': DebounceDemo,
    '/SignUpForm': SignUpForm,
    '/PriceTable': PriceTable,
    '/RoratingImageGallery': RoratingImageGallery,
    '/StatisticDashBoard': StatisticDashBoard,
    '/DailyProgress': DailyProgress,
    '/SliderRadioButtion': SliderRadioButtion,
    '/Profile': Profile
  }

  let newRoutes: RoutesType = {}
  for (let key in routes) {
    if (routes.hasOwnProperty(key)) {
      newRoutes[`${prefixKey}${key}`] = routes[key]
    }
  }

  routes = newRoutes
  return () => routes
})(prefix)

export default getRoutes()
